﻿@{
    ViewBag.Title = "Add A New Features";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
    List<KRM.Core.Sections> lstSections = ViewBag.Section;
}
<script>
    $(document).ready(function() {
        $("#fr-addfeature").submit(function () {
            var serializedForm = $(this).serialize();
            App.blockUI($('body'));
            $.ajax({
                type: 'POST',
                url: '/products/SaveProductFeatures',
                data: serializedForm,
                success: function (data2) {
                    window.opener.loadFeatureTable(data2);
                    App.unblockUI($('body'));
                    window.close();
                },
                error: function () {
                    alert('error!');
                    App.unblockUI($('body'));
                }
            });
            return false;
        });
    });
</script>
<script src="~/js/product.js"></script>
<div class="container-fluid">
    <div class="row-fluid">
        <form method="POST" id="fr-addfeature">
            <div class="span5">
                <div class="row-fluid">
                    <div class="fieldset">
                        <div class="legend"><span>Edit Feature</span></div>
                        <div class="row-fluid">
                            <div class="span4">Feature Name</div>
                            <div class="span8">
                                <input name="featurename" type="text" class="input-block-level" required="required"/>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">Feature Type</div>
                            <div class="span8">
                                @Html.DropDownList("TypeID", null, new { @class = "input-block-level" })
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">Feature Group</div>
                            <div class="span8">
                                @Html.DropDownList("GroupID", null, new { @class = "input-block-level" })
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <label>
                                    <input type="checkbox" name="issitespecific" class="checkbox" />
                                    Is Site Specific               
                                </label>
                            </div>
                            <div class="span6">
                                <label>
                                    <input type="checkbox" name="required" class="checkbox" />
                                    Required
                                </label>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <label>
                                <input type="checkbox" class="checkbox" name="globalfeature" />
                                All products have this feature
                            </label>
                        </div>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="fieldset">
                        <div class="legend"><span>Shopping Portals (Feature as Attribute)</span></div>
                        <div class="row-fluid">
                            <div class="span4">Name of Attribute</div>
                            <div class="span8">
                                <input type="text" name="nameattribute" class="input-block-level" />
                            </div>
                        </div>
                        <div class="row-fluid">
                            <label>
                                <input type="checkbox" name="portalenabled" class="checkbox" />
                                Portal Enabled
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="span7">
                <div class="fieldset">
                    <div class="legend"><span>Feature Section (Website Template)</span></div>
                    <div class="row-fluid" id="feature-section" style="max-height: 258px; overflow: auto; margin-bottom: 10px;">
                        @foreach (var item in lstSections)
                        {
                            <label>
                                <input type="checkbox" class="checkbox" value="@item.SectionID" />
                                @item.SectionName
                            </label>
                        }
                    </div>
                    <input type="hidden" name="featuresection" id="featuresection" value="" />
                    <div class="row-fluid text-right">
                        <input type="submit" class="btn btn-primary w90" value="Save" />
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
